#include<iostream>
using namespace std;
//加号运算重载
class Person
{
public:

    //1、成员函数重载+号
    Person operator+(Person &p)
    {
        Person temp;
        temp.m_a=this->m_a+p.m_a;
        temp.m_b=this->m_b+p.m_b;
        return temp;
    }


    int m_a;
    int m_b;
};
void test01()
{
    Person p1;
    p1.m_a=10;
    p1.m_b=10;
    Person p2;
    p2.m_a=10;
    p2.m_b=10;
    Person p3=p1+p2;
    //等价于Person p3=p1.operator+(p2);
    //运算符重载，也可以发生函数重载
    cout<<"p3.m_a:"<<p3.m_a<<endl;
    cout<<"p3.m_b:"<<p3.m_b<<endl;
}
int main()
{
    test01();
    return 0;
}
